package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("channelTypeList")
public class ChannelTypeList extends EntityQuery<ChannelType> {

	private static final String EJBQL = "select channelType from ChannelType channelType";

	private static final String[] RESTRICTIONS = {
			"lower(channelType.id.epgPos) like lower(concat(#{channelTypeList.channelType.id.epgPos},'%'))",
			"lower(channelType.id.category) like lower(concat(#{channelTypeList.channelType.id.category},'%'))", };

	private ChannelType channelType;

	public ChannelTypeList() {
		channelType = new ChannelType();
		channelType.setId(new ChannelTypeId());
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public ChannelType getChannelType() {
		return channelType;
	}
}
